package com.yidu.boss.sys.service.impl;

import com.yidu.boss.sys.dao.ResourceMapper;
import com.yidu.boss.sys.domain.Resource;
import com.yidu.boss.sys.domain.ResourceExample;
import com.yidu.boss.sys.service.ResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author Administrator
 * @Date 2019/11/22 10:24
 */
@Service
public class ResourceServiceImpl implements ResourceService {

    @Autowired
    ResourceMapper resourceMapper;

    @Override
    public List<Resource> selectAll() {
        List<Resource> resources = resourceMapper.selectByExample(null);
        return resources;
    }

    @Override
    public List<Resource> selectByParentId(String parentId) {
        ResourceExample resourceExample = new ResourceExample();
        resourceExample.or().andParentIdEqualTo(parentId);
        List<Resource> resources = resourceMapper.selectByExample(resourceExample);
        return resources;
    }
}
